﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using BLL;

namespace ERPWeb
{
    public partial class RawsAddWeb : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnReturn_Click(object sender, EventArgs e)
        {
            Response.Redirect("RawsManagerWeb.aspx");
        }

        protected void btnPreservation_Click(object sender, EventArgs e)
        {
            RawsInfo raws = RawsInfoManager.Add(txtName.Text, txtAddress.Text, txtSupplier.Text, Convert.ToDouble(txtPrice.Text), txtunit.Text, txtIntroduce.Text, txtRemark.Text, txtstates.Text, txtPeople.Text, Convert.ToDateTime(txtTime.Text));
            if (raws==null)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "AddFailed", "<script>alert('保存失败')</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "AddSucess", "<script>alert('保存成功')</script>");
                txtName.Text = ""; 
                txtAddress.Text = ""; 
                txtSupplier.Text = ""; 
                txtPrice.Text = ""; 
                txtunit.Text = ""; 
                txtIntroduce.Text = ""; 
                txtRemark.Text = ""; 
                txtstates.Text = ""; 
                txtPeople.Text = ""; 
                txtTime.Text = "";
            }
        }
    }
}